home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
7_7.lha
/
7_7
/
7_7getprev.c
< prev
next >
Wrap
Text File
|
1993-08-08
|
619b
|
39 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
/ Get the previous entry from a list,
/ removing it afterwards
nt dlist_iterator::getprev(ent &a)
if (!curr_dlist->last)
return 0;
// choose the link to remove
dlink *f;
if (curr)
if (curr == curr_dlist->last->prev)
{
curr = 0;
return 0;
}
else
f = curr->prev;
else
curr = curr_dlist->last;
a = f->e;
// remove f from the list
if (f == curr_dlist->last)
curr_dlist->last = 0;
else
f->remove();
delete f;
return 1;